package easy;

public class Solution_LCP_17 {

    public int calculate(String s) {
        int x = 1, y = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(0) == 'A') {
                x = (x << 1) + y;
            } else {
                y = (y << 1) + x;
            }
        }
        return x + y;
    }
}
